// --------------------------------------------------------------------
//   name 	: 
//   desc 	: 
//   version 	: 
//   dev 	: 
// --------------------------------------------------------------------
// DEPENDENCIES
// 
// --------------------------------------------------------------------
// CHANGE HISTORY
// 0.1 	Initial Release
// --------------------------------------------------------------------
	plugins.nobleCoins = { // One click to buy X coins at once

		'enhance_game_snob' : function() {

			var cost_wood = 28000;
			var cost_clay = 30000;
			var cost_iron = 25000;

			var lowest_coin = 0;
			var coin_wood = Math.floor(parseInt($("#wood").html())/cost_wood);
			var coin_iron = Math.floor(parseInt($("#iron").html())/cost_iron);
			var coin_clay = Math.floor(parseInt($("#stone").html())/cost_clay);

			if (coin_wood <= coin_iron && coin_wood <= coin_clay) {lowest_coin = coin_wood;}
			if (coin_iron <= coin_wood && coin_iron <= coin_clay) {lowest_coin = coin_iron;}
			if (coin_clay <= coin_wood && coin_clay <= coin_iron) {lowest_coin = coin_clay;}

			if ($("table.vis:last a").length > 0 && lowest_coin > 1) {

				var coinlink = $("table.vis:last a")[0].getAttribute("href");

				$("table.vis:last").after("<p>You can make a total of "+lowest_coin+" coins. <a href=\"javascript:makeCoins("+lowest_coin+",'"+coinlink+"');\">Do this now</a></p>");
	
				setFunc("makeCoins", function(coincount, coinlink) {
					for(i = 1; i <= coincount; i++) {
						ajax(twe.Server+"/"+coinlink);
					}
					document.location.reload();
				});
			}
		},
  'info' : {
	  'mandatory': false,
   'name' : "Noble coin bulk buyer",
   'desc' : "Buy your noble coins in bulk rather than one at the time",
   'version' : "0.1",
   'dev' : "Timas"
  }

	};